#pragma once
#include <vector>
#include <stdexcept>

#include "image2d_ptr.h"

namespace Image2D {

class Image2D_Imp
{
private:
    void*                m_data    [4]{nullptr};
    size_t               m_linesize[4]{0};
    int                  m_width      {0};
    int                  m_height     {0};

    ImageFormat          m_format{ImageFormat::IMAGE_NONE};
    ImageType            m_type  {ImageType::IMAGE_UNSIGNED_CHAR};

public:
    Image2D_Imp();
    Image2D_Imp(int width, int height, ImageFormat format = ImageFormat::IMAGE_NV12, ImageType type = ImageType::IMAGE_UNSIGNED_CHAR);
    Image2D_Imp(const void** data, const size_t* linesize, int width, int height, ImageFormat format = ImageFormat::IMAGE_NV12, ImageType type = ImageType::IMAGE_UNSIGNED_CHAR);
    ~Image2D_Imp();

    const int         width()             const;
    const int         height()            const;
    const void**      data()              const;
    const void*       data(int index)     const;
    const size_t*     linesize()          const;
    const size_t      linesize(int index) const;
    const ImageFormat format()            const;
    const ImageType   type()              const;
    const int         typeSize()          const;
};

}